package com.example.connecting_dots_android;

import android.app.Activity;
import android.os.Bundle;

public class GameRules extends Activity{
	private boolean mIsMute;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_game_rules);	
		init();
		settings();
	}

	/**
	 * method to manage the background image and the music
	 * */
	private void settings() {
		Utils.setBackgroundImage(this, findViewById(R.id.gameRulesLayout));
		
		if (MainActivity.mServ!= null && mIsMute && !MainActivity.mServ.isPlaying()) {
			MainActivity.mServ.resume();
		}
	}

	/**
	 * method to initialize class members
	 * */
	private void init() {
		mIsMute = Utils.getIsMute(this);
	}
	
	@Override
	protected void onPause() {
		// TODO Auto-generated method stub
		super.onPause();
		init();
		if (MainActivity.mServ!= null && mIsMute) {
			MainActivity.mServ.pause();
		}
	}
	
	@Override
	protected void onResume() {
		// TODO Auto-generated method stub
		super.onResume();
		init();
		Utils.setBackgroundImage(this, findViewById(R.id.gameRulesLayout));
		settings();
	}
}
